<?xml version="1.0" encoding="UTF-8"?>
<!--

       Copyright 2006-2016 the original author or authors.

       Licensed under the Apache License, Version 2.0 (the "License");
       you may not use this file except in compliance with the License.
       You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

       Unless required by applicable law or agreed to in writing, software
       distributed under the License is distributed on an "AS IS" BASIS,
       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       See the License for the specific language governing permissions and
       limitations under the License.

-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>The &lt;commentGenerator&gt; Element</title>
    <link rel="stylesheet" type="text/css" href="../mbgstyle.css"/>
</head>
<body>
<h1>The &lt;commentGenerator&gt; Element</h1>
<p>The &lt;commentGenerator&gt; element is used to define properties of the Comment Generator.
    The Comment Generator is used to generate comments for the various elements generated by
    MyBatis Generator (MBG) (Java fields, Java methods, XML elements, etc.).
    The default Comment Generator adds JavaDoc comments to all generated Java elements to enable
    the Java merge functionality in the Eclipse plugin. Also, comments are added to each
    generated XML element. The purpose of the comments is also to inform users that the
    elements are generated and are subject to regeneration (i.e. - they shouldn't be
    altered). This element is an optional child element
    of the <a href="context.html">&lt;context&gt;</a> element.</p>

<p>The default implementation is <code>org.mybatis.generator.internal.DefaultCommentGenerator</code>.
    The default implementation is designed for extensibility if you only want to modify
    certain behaviors.</p>

<h2>Required Attributes</h2>
<p>None</p>

<h2>Optional Attributes</h2>
<table border="1" cellspacing="0" cellpadding="5">
    <tr>
        <th>Attribute</th>
        <th>Description</th>
    </tr>
    <tr>
        <td valign="top">type</td>
        <td>This may be used to specify the type of the user provided Comment Generator.
            The class must implement the interface <code>org.mybatis.generator.api.CommentGenerator</code>
            and must have a public default constructor. The attribute also accepts
            the special value DEFAULT in which case the default implementation will
            be used (this has the same effect as not specifying the type).
        </td>
    </tr>
</table>

<h2>Child Elements</h2>
<ul>
    <li><a href="property.html">&lt;property&gt;</a> (0..N)</li>
</ul>

<h2>Supported Properties</h2>
<p>This table lists the properties of the default comment generator that can be
    specified with the <a href="property.html">&lt;property&gt;</a> child element:</p>
<table border="1" cellspacing="0" cellpadding="5">
    <tr>
        <th>Property Name</th>
        <th>Property Values</th>
    </tr>
    <tr>
        <td valign="top">suppressAllComments</td>
        <td>
            This property is used to specify whether MBG will include any coments in the
            generated code.
            The property supports these values:
            <table>
                <tr>
                    <th valign="top">false</th>
                    <td><i>This is the default value</i>
                        <br/>When the property is false or unspecified, all generated elelments
                        will include comments indicating that the element is a generated element.
                    </td>
                </tr>
                <tr>
                    <th valign="top">true</th>
                    <td>When the property is true, no comments will be added to any
                        generated element.
                    </td>
                </tr>
            </table>
            <p><b>Warning: </b> if you set this value to true, then all code merging will be disabled.</p>
        </td>
    </tr>
    <tr>
        <td valign="top">suppressDate</td>
        <td>
            This property is used to specify whether MBG will include the generation
            timestamp in the generated comments.
            The property supports these values:
            <table>
                <tr>
                    <th valign="top">false</th>
                    <td><i>This is the default value</i>
                        <br/>When the property is false or unspecified, all generated comments
                        will include the timestamp when the element was generated.
                    </td>
                </tr>
                <tr>
                    <th valign="top">true</th>
                    <td>When the property is true, no timestamp will be added to the
                        generated comments.
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td valign="top">addRemarkComments</td>
        <td>
            This property is used to specify whether MBG will include table and column
            remarks from db table in the generated comments.
            The property supports these values:
            <table>
                <tr>
                    <th valign="top">false</th>
                    <td><i>This is the default value</i>
                        <br/>When the property is false or unspecified, all generated comments
                        will <b>not</b> include table and column remarks from db table
                        when the element was generated.
                    </td>
                </tr>
                <tr>
                    <th valign="top">true</th>
                    <td>When the property is true, table and columns remarks from db table
                        will be added to the generated comments.
                    </td>
                </tr>
            </table>
            <p><b>Warning: </b> If suppressAllComments option is true, this option will be ignored.</p>
        </td>
    </tr>
    <tr>
        <td valign="top">dateFormat</td>
        <td>A date format string to use when writing the date into the generated comment. This string
            will be used to construct a <code>java.text.SimpleDateFormat</code> object. Any
            valid format string for that object can be specified here. By default, the date string
            will be from the <code>toString()</code> method on <code>java.util.Date</code>.
            <p>Since 1.3.4</p>
            <p><b>Warning: </b> If the suppressAllComments option is true, this option will be ignored.</p>
            <p><b>Warning: </b> If the suppressDate option is true, this option will be ignored.</p>
        </td>
    </tr>
</table>

<h2>Example</h2>
<p>This element specifies that we do not want the timestamp added to any generated comment:</p>
<pre>
&lt;commentGenerator&gt;
  &lt;property name="suppressDate" value="true" /&gt;
&lt;/commentGenerator&gt;
</pre>

</body>
</html>
